from django.conf.urls import url, include
from django.contrib import admin
from apps.users import views

urlpatterns = [
    # 1 注册视图
    url(r'^register/$', views.RegisterView.as_view(), name='register'),
    # 2 用户名验证重复 url = this.host + '/usernames/' + this.username + '/count/';
    url(r'^usernames/(?P<username>[a-zA-Z0-9_]{5,20})/count/$', views.UsernameCountView.as_view(), name='usernamecount'),
    # 3 验证手机号是否重复 url = this.host + '/mobiles/' + this.mobile + '/count/';
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view(), name='mobilecount'),
    # 4 用户登陆页面
    url(r'^login$', views.LoginView.as_view(), name='login'),
    # 5 退出登陆
    url(r'^logout/$', views.LogoutView.as_view(), name='logout'),
    # 6 用户中心
    url(r'^info/$', views.UserInfoView.as_view(), name='userinfo'),
    # 7 增加邮箱
    url(r'^emails/$', views.EmailView.as_view(), name='email'),
    # 8 邮箱激活
    url(r'^emails/verification/$', views.EmailVerificationView.as_view(), name='emailverifition'),
    # 9 收货地质 address
    url(r'^address/$', views.AddressView.as_view(), name='address'),
    # 10 提供省市区查表数据
    url(r'^areas/$', views.AreasView.as_view(), name='areas'),
    # 11 新增收货地址
    url(r'^addresses/create/$', views.AddAddressView.as_view(), name='addaddress'),
    # 12 修改地址 PUT 删除地址 DELETE
    url(r'^addresses/(?P<address_id>\d+)/$', views.EditAddressView.as_view(), name='editaddress'),
    # 13 设置默认地址 /
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.SetDefaultAddressView.as_view(), name='setdefaultaddress'),
    # 14 修改地址标题  /addresses/(?P<address_id>\d+)/title/
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.EditAddressTitleView.as_view(), name='editaddresstitle'),
    # 15 密码
    url(r'^password/$', views.PwdView.as_view(), name='password'),
    # 16 用户浏览历史
    url(r'^browse_histories/$', views.BrowseHistoriesView.as_view(), name='browse_histories'),
    # 17 用户订单列表
    url(r'^orders/info/(?P<page_num>\d+)/$', views.UserOrderView.as_view(), name='userorder'),

]
